package com.sz.wu.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

@Configuration
public class SwaggerConfig {
    @Bean
    public Docket buildDocket() {
        return new Docket(DocumentationType.SWAGGER_2).apiInfo(buildApiInfo()).select().
                apis(RequestHandlerSelectors.basePackage("com.sz.wu.controller")).
                paths(PathSelectors.any()).build();
    }

    private ApiInfo buildApiInfo() {
        return new ApiInfoBuilder().title("SpringBoot集成Swagger2框架").description("SpringBoot集成Swagger2框架接口调用")
                .termsOfServiceUrl("baidu.com").contact(new Contact("wujinfneg","baidu.com","254@qq.com"))
                .version("1.0").build();
    }
}
